package VO;

import java.util.ArrayList;

import Promotion.Goodsconversions;
import Promotion.GoodsconversionsList;

public class GoodsconversionsListVO {
	ArrayList<GoodsconversionsVO> Goodsconversionslist=new ArrayList<GoodsconversionsVO>();
	String gconID="";
	
	public GoodsconversionsListVO(){}
	public GoodsconversionsListVO(ArrayList<GoodsconversionsVO>  gclist){
		Goodsconversionslist=gclist;
		init();
	}
	public GoodsconversionsListVO(GoodsconversionsList  gclist){
		for(Goodsconversions gc: gclist.getGoodsconversionslist()){
			GoodsconversionsVO gcvo=new GoodsconversionsVO(gc);
			Goodsconversionslist.add(gcvo);
		}
		init();
	}
	public GoodsconversionsListVO(String gconlistinfo[][]){
		for(String gconinfo[]:gconlistinfo){
			GoodsconversionsVO gv=new GoodsconversionsVO(gconinfo);
			Goodsconversionslist.add(gv);
		}
	}
	
	public GoodsconversionsListVO(GoodsconversionsListVO gconlOfAll,String gconidList){
		String[] gconidlist=gconidList.split("/");
		if(gconidList.equals("")){
			for(String id:gconidlist){
				GoodsconversionsVO gconvo=gconlOfAll.find(Long.parseLong(id));
				Goodsconversionslist.add(gconvo);
			}
			init();
		}
		
	}
	public void init(){
		for(GoodsconversionsVO gcon:Goodsconversionslist){
			gconID=gconID+"/"+gcon.getID();
		}
	}
	public GoodsconversionsVO find(long id){
		GoodsconversionsVO gcon=null;
		for(GoodsconversionsVO g:Goodsconversionslist){
			if(g.getID()==id){
				gcon=g;
				break;
			}
		}
		return gcon;
	}
	public ArrayList<GoodsconversionsVO> getGoodsconversionslist(){
		return Goodsconversionslist;
	}
	public String getgconlid(){
		return gconID;
	}
	
	

}
